<?php

class Application_Form_Action extends Zend_Form
{
    private $view;
    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
        $this->view = Zend_Layout::getMvcInstance()->getView();
        
        // create id element
        $id = $this->createElement("hidden","idactions");
        $id->setDecorators(array("ViewHelper"));
        $this->addElement($id);
        
        //create element display_name
        $display_name = $this->createElement("text","display_name");
        $display_name->setLabel("Tên trình bày")
                     ->setRequired()
                     ->addValidators(array(
                        array("NotEmpty",false,array("messages"=>array('isEmpty'=>"Tên trình bày là bắt buộc."))),
                     ))
                     ->setAttrib("size","50");            
        $this->addElement($display_name);
        
        //create element controller_name
        $controller_name = $this->createElement("text","action_name");
        $controller_name->setLabel("Tên action")
                     ->setRequired()
                     ->addValidators(array(
                        array("NotEmpty",false,array("messages"=>array('isEmpty'=>"Tên action là bắt buộc."))),
                     ))
                     ->setAttrib("size","50");            
        $this->addElement($controller_name);
        
        
        
        // create submit button
        $submit = $this->createElement("submit","submit");
        $submit->setLabel("Thêm Action")
               ->setAttrib("class","btn btn-black");
        $this->addElement($submit);
        
        // create submit button
        $link = $this->view->url(array(
            'module'=>"admin",
            'controller'=>"webconfig",
            'action'=>"developer"
        ));
        $cancel = $this->createElement("button","cancel");
        $cancel->setLabel("Quay lại")
               ->setAttrib("class","btn btn-red")
               ->setAttrib("onclick","window.location='$link'");
        $this->addElement($cancel);  
        
        
    }

}

